Xbasic

A5_CHANGEFIELDSIZE Function

Syntax

Result_Flag as L = a5_ChangeFieldSize(C tablename ,C original_sizes ,C new_sizes )

Arguments

Result_Flag

.T. indicates success. .F. indicates failure.

tablename

The name of the table to modify. Character

original_sizes

A CR-LF delimited list of fields to change in the following format. Character

Argument
Description
Fieldname

The name of the field as seen in the Table Editor.

Type

See Field Types.

Width

The current width of the field.

Decimal

The current number of decimal places of the field. Non-numeric fields have a decimal of 0.

new_sizes

A CR-LF delimited list of the new values to assign. The list is in the same format as above, but provides new values for Width and Decimal where appropriate.

Description

Changes the fields sizes (width and decimal places) of fields in a table. Takes a crlf delimited list of fields. Format for original_sizes and new_sizes is 'fieldname,type,width,decimal_places'

Discussion

The A5_CHANGEFIELDSIZE() changes the sizes (width or decimal places) of a list of fields in a table.

Example

? table.external_field_name_get("customer", "n,T,w,d")
= Customer_id,Character,8,0
Firstname,Character,20,0
Lastname,Character,20,0
Company,Character,32,0
Phone,Character,20,0
Fax,Character,20,0
tablename = "customer"
original_sizes = <<%a%
Fax,c,20,0
Phone,c,20,0
%a%
new_sizes = <<%a%
Fax,c,30,0
Phone,c,30,0
%a%
a5_changefieldsize("customer", original_sizes, new_sizes)
? table.external_field_name_get("customer","n,T,w,d")
= Customer_id,Character,8,0
Firstname,Character,20,0
Lastname,Character,20,0
Company,Character,32,0
Phone,Character,30,0
Fax,Character,30,0

See Also